﻿using System;
using System.Windows.Media.Imaging;
using System.Windows.Media;

namespace CloudTaobao
{
    public class TradeRate
    {
        public bool valid_score { get; set; }
        public string tid { get; set; }
        public string oid { get; set; }
        public string role { get; set; }
        public string nick { get; set; }
        public string result { get; set; }
        public string created { get; set; }
        public string rated_nick { get; set; }
        public string item_title { get; set; }
        public string item_price { get; set; }
        public string content { get; set; }
        public string reply { get; set; }
        public string hasReply 
        {
            get 
            {
                if(reply=="")
                    return "Collapsed";
                else
                    return "Visible";
            } 
        }
        public string leftPic 
        {
            get
            {
                if ("good".Equals(result))
                    return "images/left_green.png";
                else if ("neutral".Equals(result))
                    return "images/left_yellow.png";
                else
                    return "images/left_red.png";
            }
        }
        public string topPic
        {
            get
            {
                if ("good".Equals(result))
                    return "images/top_green.png";
                else if ("neutral".Equals(result))
                    return "images/top_yellow.png";
                else
                    return "images/top_red.png";
            }
        }
        public object centerPic
        {
            get
            {
                if ("good".Equals(result))
                    return new ImageBrush
                   {
                       ImageSource = new BitmapImage(new Uri("images/center_green.png", UriKind.Relative)),
                       Stretch = Stretch.Fill
                   };
                else if ("neutral".Equals(result))
                    return new ImageBrush
                   {
                       ImageSource = new BitmapImage(new Uri("images/center_yellow.png", UriKind.Relative)),
                       Stretch = Stretch.Fill
                   };
                else
                    return new ImageBrush
                    {
                        ImageSource = new BitmapImage(new Uri("images/center_red.png", UriKind.Relative)),
                        Stretch = Stretch.Fill
                    };
            }
        }
        public string bottomPic
        {
            get
            {
                if ("good".Equals(result))
                    return "images/bottom_green.png";
                else if ("neutral".Equals(result))
                    return "images/bottom_yellow.png";
                else
                    return "images/bottom_red.png";
            }
        }

        public TradeRate()
        {
            valid_score = false;
            tid = "";
            oid = "";
            role = "";
            nick = "";
            result = "";
            created = "";
            rated_nick = "";
            item_title = "";
            item_price = "";
            content = "";
            reply = "";
        }
    }
}
